package cn.wolfcode.p2p.web.listener;

import cn.wolfcode.p2p.base.service.ILoginInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * 初始化后台管理员的监听器
 */
@Component
public class InitSystemAdminListener implements ApplicationListener<ContextRefreshedEvent> {

    @Autowired
    private ILoginInfoService loginInfoService;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        System.out.println("==============启动后台项目,可以配置到日志中===============");
        loginInfoService.initAdmin();
    }
}
